#define SAMPLE_COUNT 15

cbuffer Samples {
  uniform float2 SampleOffsets[SAMPLE_COUNT];
  uniform float SampleWeights[SAMPLE_COUNT];
    uniform float4x4 SpriteTransform;
};

uniform Texture2D Texture;
uniform SamplerState TextureSampler {
	Filter = MIN_MAG_MIP_LINEAR;
	AddressU = Wrap;
	AddressV = Wrap;
};

struct VSInputTx {
	float3 Position : POSITION;
	float2 TexCoord : TEXCOORD;
};

struct VSOutputTx {
	float4 PositionPS : SV_POSITION;
	float2 TexCoord : TEXCOORD;
};


VSOutputTx VS_Blur(VSInputTx input) {
	VSOutputTx output;
	output.PositionPS = mul(float4(input.Position, 1.0), SpriteTransform);
	output.TexCoord = input.TexCoord;
	return output;
}



float4 PS_Blur(VSOutputTx input)  : SV_TARGET {
  float4 color = float4(0,0,0,0);
  
  for(int i = 0; i < SAMPLE_COUNT; i++) {
    color += Texture.Sample(TextureSampler, input.TexCoord + SampleOffsets[i]) * SampleWeights[i];
  }
  
  return color;
}


technique10 GaussianBlur {
  pass pass0 {
    SetGeometryShader(0);
	//SetVertexShader(0);
		SetVertexShader(CompileShader(vs_4_0, VS_Blur()));
		SetPixelShader(CompileShader(ps_4_0, PS_Blur()));
  }
}